
unit StarInterfaceObject;

interface

type

  TStarInterfaceInfo=Record
    ClassName:string;
    ModuleName:string;
    GUID:String;
    Title:string;
    Author:string;
    Version:string;
    Comments:String;
  end;

  IStaInterfaceInfoGetter=Interface
    ['{3FD01240-5D5B-4164-A6B6-67CD9FA8E67F}']
    procedure GetInterfaceInfo(Info:TStarInterfaceInfo);
  end;

  IStarInterfaceInfo=Interface
    ['{A4AC764B-1306-4FC3-9A0F-524B25C56992}']
    function GetInterfaceInfo:TStarInterfaceInfo;
  end;

  IStarInterfaceInfoExtend=interface
    ['{F15AF91A-5B7A-41B9-BD05-56E16BBA603B}']
    function GetInterfaceInfo(IIDStr:string):TStarInterfaceInfo;
  end;

  TStarInterfacedObject=Class(TObject,IInterface)
  private

  protected
    {IInterface}
    function QueryInterface(const IID: TGUID; out Obj): HResult; stdcall;
    function _AddRef: Integer; stdcall;
    function _Release: Integer; stdcall;
  public
  end;

implementation

{ TStarInterfaceObject }

function TStarInterfacedObject.QueryInterface(const IID: TGUID; out Obj): HResult;
begin
  if GetInterface(IID, Obj) then
    Result := 0
  else
    Result := E_NOINTERFACE;
end;

function TStarInterfacedObject._AddRef: Integer;
begin
  Result:=-1;
end;

function TStarInterfacedObject._Release: Integer;
begin
  Result:=-1;
end;

end.
